/*
 *  Copyright (c) 2011, StripBandunk and/or its affiliates. All rights reserved.
 * 
 *       http://stripbandunk.com/
 * 
 *  STRIPBANDUNK PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package stripbandunk.tutorial.jtreedemo;

import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel;

/**
 *
 * @author Eko Kurniawan Khannedy
 */
public class TreeModelCreator {

    private DefaultTreeModel model;

    private DefaultMutableTreeNode root;

    public TreeModelCreator(String rootData) {
        root = new DefaultMutableTreeNode(rootData);
        model = new DefaultTreeModel(root);
    }

    public void addChild(String child) {
        root.add(new DefaultMutableTreeNode(child));
    }

    public TreeModel getModel() {
        return model;
    }
}
